/**
 * Created by Xuelei.kong on 2016/7/2.
 */
function showTime(){
    var show_day=new Array('星期一','星期二','星期三','星期四','星期五','星期六','星期日');
    var time=new Date();
    var year=time.getFullYear();
    var month=time.getMonth()+1;
    var date=time.getDate();
    var day=time.getDay();
    var hour=time.getHours();
    var minutes=time.getMinutes();
    var second=time.getSeconds();
    month=month<10?"0"+month:month;
    date=date<10?"0"+date:date;
    hour<10?hour='0'+hour:hour;
    minutes<10?minutes='0'+minutes:minutes;
    second<10?second='0'+second:second;
    var now_time= year+'年'+month+'月'+date+'日'+' '+show_day[day-1];
    var time=hour+':'+minutes+':'+second;
    document.getElementById('date').innerHTML=now_time;
    document.getElementById('time').innerHTML=time;
    setTimeout("showTime();",1000);
}
showTime();


// 指定图表的配置项和数据
//综合能耗对比
optionZhnhMonth = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['本月', '上月'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '本月',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '上月',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};
optionZhnhYear = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['去年', '今年'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '去年',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '今年',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};
//标准产品单耗对比
optionCpdhMonth = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['本月', '上月'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '本月',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '上月',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};
optionCpdhYear = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['去年', '今年'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '去年',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '今年',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};

//当月能源费用

optionDynh = {
    title : {
        text: '当月能源费用(元)',
        subtext: '',
        x:'center',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#4f81bd","#c0504d","#9bbb59","#8064a2"
    ],
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'right',
        data: ['峰时电费','平时电费','谷时电费','天然气费用'],
        textStyle:{
            color:"#fff"
        }
    },
    series : [
        {
            name: '费用',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:335, name:'峰时电费'},
                {value:310, name:'平时电费'},
                {value:234, name:'谷时电费'},
                {value:135, name:'天然气费用'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};

//电能耗配置
optionDnhMonth = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['本月', '上月'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '本月',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '上月',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};
optionDnhYear = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['去年', '今年'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '去年',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '今年',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};


//天然气配置

optionTrqMonth = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['本月', '上月'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '本月',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '上月',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};
optionTrqYear = {
    title: {
        text: '',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#e5004f","#5fb9a1"
    ],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        data: ['去年', '今年'],
        textStyle:{
            color:"#fff"
        }
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
    },
    xAxis: {
        type: 'category',
        data: ['1','2','3','4','5','6'],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }

    },
    yAxis: {
        type: 'value',
        boundaryGap: [0, 0.01],
        axisLine:{
            lineStyle:{
                color:"#fff"
            }
        }
    },
    series: [
        {
            name: '去年',
            type: 'bar',
            data: [1, 2, 3, 4, 5, 6],
            barWidth:"6"
        },
        {
            name: '今年',
            type: 'bar',
            data: [2, 3, 2, 4, 5, 6],
            barWidth:"6"
        }
    ]
};


/*各车间用电费用*/
//今日电费
var optionCjydDay= {
    backgroundColor:"#114855",
    color:[
        "#4f81bd","#c0504d","#9bbb59","#8064a2"
    ],
    title : {
        x:'center',
        left:"50%",
        top:20,
        textAlign:"center",
        text: '今日电费',
        textStyle:{
            color:"#fff"
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left'
    },
    series : [
        {
            name: '电',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:335, name:'车间1'},
                {value:310, name:'车间2'},
                {value:234, name:'车间3'},
                {value:135, name:'车间4'},
                {value:135, name:'车间5'},
                {value:135, name:'车间6'},
                {value:135, name:'车间7'},
                {value:135, name:'车间8'},
                {value:135, name:'车间9'},
                {value:135, name:'车间10'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};
//当月电费
var optionCjydMonth= {
    backgroundColor:"#114855",
    color:[
        "#4f81bd","#c0504d","#9bbb59","#8064a2"
    ],
    title : {
        x:'center',
        left:"50%",
        top:20,
        textAlign:"center",
        text: '当月电费',
        textStyle:{
            color:"#fff"
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left'
    },
    series : [
        {
            name: '电',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:335, name:'车间1'},
                {value:310, name:'车间2'},
                {value:234, name:'车间3'},
                {value:135, name:'车间4'},
                {value:135, name:'车间5'},
                {value:135, name:'车间6'},
                {value:135, name:'车间7'},
                {value:135, name:'车间8'},
                {value:135, name:'车间9'},
                {value:135, name:'车间10'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};

//当年电费
var optionCjydYear= {
    backgroundColor:"#114855",
    title : {
        x:'center',
        left:"50%",
        top:20,
        textAlign:"center",
        text: '当年电费',
        textStyle:{
            color:"#fff"
        }
    },
    color:[
        "#4f81bd","#c0504d","#9bbb59","#8064a2"
    ],
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient: 'vertical',
        left: 'left'
    },
    series : [
        {
            name: '电',
            type: 'pie',
            radius : '55%',
            center: ['50%', '60%'],
            data:[
                {value:335, name:'车间1'},
                {value:310, name:'车间2'},
                {value:234, name:'车间3'},
                {value:135, name:'车间4'},
                {value:135, name:'车间5'},
                {value:135, name:'车间6'},
                {value:135, name:'车间7'},
                {value:135, name:'车间8'},
                {value:135, name:'车间9'},
                {value:135, name:'车间10'}
            ],
            itemStyle: {
                emphasis: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }
    ]
};


var myChartZhnhMonth = echarts.init(document.getElementById('zhnh_month'));
myChartZhnhMonth.setOption(optionZhnhMonth);

var myChartZhnhYear = echarts.init(document.getElementById('zhnh_year'));
myChartZhnhYear.setOption(optionZhnhYear);


var myChartCpdhMonth = echarts.init(document.getElementById('cpdh_month'));
myChartCpdhMonth.setOption(optionCpdhMonth);

var myChartCpdhYear = echarts.init(document.getElementById('cpdh_year'));
myChartCpdhYear.setOption(optionCpdhYear);




//电能耗
var myChartDnhMonth = echarts.init(document.getElementById('Dnh_month'));
myChartDnhMonth.setOption(optionDnhMonth);

var myChartDnhYear = echarts.init(document.getElementById('Dnh_year'));
myChartDnhYear.setOption(optionDnhYear);


//天然气
var myChartTrqMonth = echarts.init(document.getElementById('trq_month'));
myChartTrqMonth.setOption(optionTrqMonth);

var myChartTrqYear = echarts.init(document.getElementById('trq_year'));
myChartTrqYear.setOption(optionTrqYear);

/*各车间用电费用*/
//日
var myChartCjydDay = echarts.init(document.getElementById('day_ele_fee'));
myChartCjydDay.setOption(optionCjydDay);
//月
var myChartCjydMonth = echarts.init(document.getElementById('month_ele_fee'));
myChartCjydMonth.setOption(optionCjydMonth);
//年
var myChartCjydYear = echarts.init(document.getElementById('year_ele_fee'));
myChartCjydYear.setOption(optionCjydYear);


/*当月能耗费用*/
var myChartDynh=echarts.init(document.getElementById('energy_fee'));
myChartDynh.setOption(optionDynh);